
//
//  InviteRuleAlertView.swift
//  MT
//
//  Created by 陈悦 on 2020/5/12.
//  Copyright © 2020 张强. All rights reserved.
//

import UIKit
import MTCategory

class InviteRuleAlertView: UIView {
    @IBOutlet weak var tipLabel: UILabel!
    @IBOutlet weak var rateTipLabel: UILabel!
    @IBOutlet weak var lessRateLabel: UILabel!
    //@IBOutlet weak var levelTipLabel: UILabel!
    @IBOutlet weak var bgView: UIView!
    @IBOutlet weak var closeBtn: UIButton!
    @IBOutlet var contentView: UIView!
    @IBAction func closeView(_ sender: Any) {
        UIView.animate(withDuration: 0.3, animations: {
            self.alpha = 0
        }) { (flag) in
            self.removeFromSuperview()
        }
    }

    @IBAction func dismissView(_ sender: Any) {
        UIView.animate(withDuration: 0.3, animations: {
            self.alpha = 0
        }) { (flag) in
            self.removeFromSuperview()
        }
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        // 加载xib
        contentView = (Bundle.main.loadNibNamed("InviteRuleAlertView", owner: self, options: nil)?.last as! UIView)
        // 设置frame
        contentView.frame = frame
        contentView.backgroundColor = UIColor.black.withAlphaComponent(0.5)
//        NSToolObjectClass.animationWithAlertViewWithView(allView: tipView)
        
        bgView.layer.cornerRadius = 8
        
        closeBtn.layer.cornerRadius = 20
        // 添加上去
        addSubview(contentView)
        
        tipLabel.font = PingFangSCMediumFont(10)
        rateTipLabel.font = PingFangSCMediumFont(12)
        lessRateLabel.font = PingFangSCMediumFont(12)
        //levelTipLabel.font = PingFangSCMediumFont(12)
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

}
